clear; clc;

dirName = 'hall';
file = dir(dirName);
file = file(3:end);

N = length(file);
fileName = file(1).name;
img = imread(strcat(dirName ,'/', fileName));
data = zeros(size(img,1), size(img,2), 3*N);


for n = 1:N
    fileName = file(n).name;
    img = imread(strcat(dirName ,'/', fileName));
    data(:,:,3*(n-1)+1:3*n) = img;
    fprintf('%d out of %d \n', n, N);
end

% gndName = strcat(dirName, '_gnd');
% file = dir(gndName);
% N = length(file);
% gnd = [];
% idx = [];
% for n = 1:N
%     fileName = file(n).name;
%     pos = strfind(fileName, '.jpg');
%     if(~isempty(pos))
%         num = fileName(1:pos - 1);
%         num = str2num(num);
%         idx = [idx, num];
%         
%         img = imread(strcat(gndName ,'/', fileName));
%         img = double(img > 127);
%         gnd = cat(3, gnd, img);
%     end
%     fprintf('%d out of %d \n', n, N);
% end

save(dirName, 'data', '-v7.3');